package com.ss.android.article.browser.view.multiselect.viewholder;

import android.content.Context;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.util.SparseBooleanArray;
import android.view.View;

import com.ss.android.article.browser.view.multiselect.a;
import com.ss.android.article.browser.view.multiselect.f;
import com.ss.android.article.browser.view.multiselect.g;

import org.jetbrains.annotations.NotNull;

public abstract class b extends ViewHolder {
    @NotNull
    public final ViewHolder b;
    @NotNull
    final a c;

    public b(@NotNull View root, @NotNull ViewHolder viewHolder, @NotNull a adapter) {
        super(new d(root.getContext(), adapter, root));
        Context context = root.getContext();
        this.b = viewHolder;
        this.c = adapter;
        if ((this.itemView instanceof d)) {
            ((d) this.itemView).setLongClickCallback(new BingoCallback() {
                public final Object invoke() {
                    com.ss.android.article.browser.view.multiselect.a aVar = b.this.c;
                    b.this.b.getAdapterPosition();
                    return aVar;
                }
            });
            ((d) this.itemView).setSelectStateClickCallback(new BingoCallback() {
                @Override
                public final Object invoke() {
                    f v0_2;
                    int v1 = 1;
                    com.ss.android.article.browser.view.multiselect.a v2 = b.this.c;
                    int v3 = b.this.b.getAdapterPosition();
                    if (v2.a != g.c()) {
                        v2.e.a(v3);
                    } else {
                        SparseBooleanArray v4 = v2.b;
                        boolean v0 = !v2.b.get(v3) ? true : false;
                        v4.put(v3, v0);
                        int v0_1 = v2.c;
                        if (!v2.b.get(v3)) {
                            v1 = -1;
                        }
                        v2.c = v0_1 + v1;
                        if (v2.b.get(v3)) {
                            v0_2 = v2.d;
                            if (v0_2 != null) {
                                v0_2.b(v2.c);
                            }
                        } else {
                            v0_2 = v2.d;
                            if (v0_2 != null) {
                                v0_2.a();
                            }
                        }
                        v2.notifyItemChanged(v3);
                    }
                    return null;
                }
            });
        }
    }

    public abstract void a(int arg1);

    public void b(int arg1) {
    }
}

